﻿/*
* @Author： whg
* @Date : 2021-1-19
* @Desc : 
*/
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XNodeEditor;
[XNodeEditor.NodeEditor.CustomNodeEditor(typeof(StoryVoNode))]
public class StoryVoEditor : NodeEditor
{
    private StoryVoNode node;
    public override void OnBodyGUI()
    {
        serializedObject.Update();
        if (node == null) node = target as StoryVoNode;

        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("index"));
        EditorGUILayout.Space();
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("storyType"));
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("SetTimes"));
        if(node.SetTimes)
        {
            EditorGUI.indentLevel++;
            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("times"));
            EditorGUI.indentLevel--;
        }
         NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("SetTotalTime"));
         if (node.SetTotalTime)
         {
             EditorGUI.indentLevel++;
             NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("totalTime"));
             EditorGUI.indentLevel--;
         }
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("SetTimeOut"));
        if (node.SetTimeOut)
        {
            EditorGUI.indentLevel++;
            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("timeout"));
            EditorGUI.indentLevel--;
        }
        if (node.storyType == StoryVoNode.StoryType.Dungeon)
        {
            EditorGUI.indentLevel++;
            NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("dungeon_id"));
            if (node.preload == "")
                node.preload = "1";
            EditorGUI.indentLevel--;
        }

        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("preload"));

        NodeEditorGUILayout.PortField(target.GetOutputPort("downLink"));
        serializedObject.ApplyModifiedProperties();
    }
}
